﻿
# -*- coding: utf-8 -*-
import aiml
import os
from flask import Flask
app = Flask(__name__)
Kernel=aiml.Kernel()
if os.path.isfile("bot_brain.brn"):
    Kernel.bootstrap(brainFile="bot_brain.brn")
else:
    Kernel.bootstrap(learnFiles="startup.xml",commands="LOAD AIML B")
    Kernel.saveBrain("bot_brain.brn")

#text=Kernel.respond('你好')
#while True:
   # text=Kernel.respond(raw_input("Enter your message >> "))
    #print text
@app.route('/get/')
@app.route('/get/<input>')
def get(input):
    text=Kernel.respond(input)
    return text

if __name__ == '__main__':
    app.run(host='0.0.0.0')

#while True:
   # seg_list = jieba.cut(raw_input("Enter your message >> "),cut_all=True)
  #  print ("Full Mode: " + "/ ".join(seg_list))
